﻿using DevExpress.CodeParser;
using MyApp.Repository;
using ReportDesignerServer.DataModel;
using ReportDesignerServer.DataModels;
using SqlSugar;

namespace ReportDesignerServer.IRepository
{
    /// <summary>
    /// 通用字典服务
    /// </summary>
    public class DictCommonService
    {
        private readonly IDictCommonRepository dictCommonRepository;
        public DictCommonService(IDictCommonRepository dictCommonRepository)
        {
            this.dictCommonRepository = dictCommonRepository;
        }

        /// <summary>
        /// 获取通用字典
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public List<DictCommon> GetDictCommons(string type)
        {
            Expressionable<DictCommon> expressionable = new Expressionable<DictCommon>();
            expressionable.And(c => c.DICTTYPE == type);
            return dictCommonRepository.GetListByWhere(expressionable);
        }
    }
}
